package com.example.day2.mvvm.utils;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;

public class MyRecyLerView extends RecyclerView {
    private boolean isInterept = true;

    public MyRecyLerView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }


    public void setInterept(boolean interept) {
        isInterept = interept;
    }
    //重写方法

    @Override
    public boolean onInterceptTouchEvent(MotionEvent e) {
        if (isInterept){
            return super.onInterceptTouchEvent(e);
        }else{
            return false;
        }


    }
}
